//
//  WeeklyLetterBean.swift
//  imprint
//
//  Created by 小柠檬🍋 on 2025/2/22.
//

import Foundation
import GRDB

// 表情包
class EmojiPictureBean : IDbTable,  Codable, Identifiable {
    
    static let databaseTableName = "EmojiPicture"

    //db排除字段
    func doCustomDBExcluded()  -> [String? : Any?] {
        return doExcluded(subject: self, excluded: [""])
    }
    
    var objectId: String?
    var key: String? = nil
    var text: String? = nil
    var path: String? = nil
    var width: Int? = nil
    var height: Int? = nil
    var mimeType: String? = nil
    var duration: Int64? = nil
    var sort: Int? = nil
    //IEmojiType.TYPE_EMOJI_PICTURE.rawValue
    var type: Int? = nil

    func isVideo() -> Bool {
        return duration ?? 0 > 0
    }
}

extension EmojiPictureBean {
    // db数据库指定字段
    public func encode(to container: inout PersistenceContainer) {
        doDBExcluded(to: &container)
    }
}
